home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 410_01 / wlist / maintest.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1995-12-30  |  46.1 KB  |  2,158 lines

  1. static char sccs_id[] = "%W% %G% %U%";
  2. /*
  3.  +++
  4.     testwlist
  5.  
  6.     PURPOSE :  test wlist class member functions
  7.  
  8.     USAGE   : testwlist  (no args)
  9.  
  10.     INPUTS  : 
  11.  
  12.     OUTPUTS : stdout, stderr
  13.  
  14.     DATE    : Sun Jan 30 20:37:46 EST 1994
  15.  
  16.     PROJECT        : WEH Software
  17.  
  18.     AUTHOR  : W. Hatch
  19.  
  20.     COMPANY : Coleman Research Corporation
  21.           9891 Broken Land Parkway
  22.           Suite 200
  23.           Columbia, Maryland 21045
  24.           Phone (301)621-8600
  25.           FAX (410)7210
  26.  
  27. ---*/ 
  28. /*
  29. ------------------------------------------------------------------------
  30.   MODIFICATIONS
  31. DATE    PROGRAMMER    DESCRIPTION
  32. ========================================================================
  33. */
  34. #include  <stdio.h>
  35. #include <tstring.h>
  36. #include <wlist.h>
  37. wlist *wlbuild(wlist *wl, int length);
  38. int     test_FirstData();
  39. int    test_LastData();
  40. int    test_CurrentData();
  41. int    test_NextData();
  42. int    test_PreviousData();
  43. int    test_PrependData();
  44. int    test_PreInsert();
  45. int    test_PostInsert();
  46. int    test_DeleteCurrent();
  47. int    test_Reverse();
  48. int    test_ExchangePrevious();
  49. int    test_ExchangeNext();
  50. int    test_Minimum();
  51. int    test_Maximum();
  52. int    test_Sort();
  53.  
  54. main(int argc, char **argv)
  55. {
  56.     if(!test_FirstData())
  57.     {
  58.         printf("wlist::FirstData() failed\n");
  59.         exit(2);
  60.     }
  61.     if(!test_LastData())
  62.     {
  63.         printf("wlist::LastData() failed\n");
  64.         exit(2);
  65.     }
  66.     if(!test_CurrentData())
  67.     {
  68.         printf("wlist::CurrentData() failed\n");
  69.         exit(2);
  70.     }
  71.     if(!test_NextData())
  72.     {
  73.         printf("wlist::NextData() failed\n");
  74.         exit(2);
  75.     }
  76.     if(!test_PreviousData())
  77.     {
  78.         printf("wlist::PreviousData() failed\n");
  79.         exit(2);
  80.     }
  81.     if(!test_PrependData())
  82.     {
  83.         printf("wlist::PrependData() failed\n");
  84.         exit(2);
  85.     }
  86.     if(!test_PreInsert())
  87.     {
  88.         printf("wlist::PreInsert() failed\n");
  89.         exit(2);
  90.     }
  91.     if(!test_PostInsert())
  92.     {
  93.         printf("wlist::PostInsert() failed\n");
  94.         exit(2);
  95.     }
  96.     if(!test_DeleteCurrent())
  97.     {
  98.         printf("wlist::DeleteCurrent() failed\n");
  99.         exit(2);
  100.     }
  101.     if(!test_Reverse())
  102.     {
  103.         printf("wlist::Reverse() failed\n");
  104.         exit(2);
  105.     }
  106.     if(!test_ExchangePrevious())
  107.     {
  108.         printf("wlist::ExchangePrevious() failed\n");
  109.         exit(2);
  110.     }
  111.     if(!test_ExchangeNext())
  112.     {
  113.         printf("wlist::ExchangeNext() failed\n");
  114.         exit(2);
  115.     }
  116.     if(!test_Minimum())
  117.     {
  118.         printf("wlist::Minimum() failed\n");
  119.         exit(2);
  120.     }
  121.     if(!test_Maximum())
  122.     {
  123.         printf("wlist::Maximum() failed\n");
  124.         exit(2);
  125.     }
  126.     if(!test_Sort())
  127.     {
  128.         printf("wlist::Sort() failed\n");
  129.         exit(2);
  130.     }
  131.     printf("\n\twlist passed all tests. the wlist class probably works OK\n");
  132.     printf("\tsend any problem reports or suggestions to uunet!bts!bill\n\n");
  133.     printf("\tGood Luck and may all of your code be correct;\n\n");
  134.     printf("\tBill Hatch   Wed Feb  2 13:58:14 EST 1994 \n");
  135.     exit(0);
  136. }    
  137. /* END main */
  138. wlist *wlbuild(wlist *wl,int length){
  139.     tstring *ts;
  140.     int i,j;
  141.     char    buf[10];
  142.  
  143.  
  144.     for(i=0; i< length; i++)
  145.     {
  146.         ts=new tstring;
  147.         sprintf(buf,"%d",((i+1)%9));
  148.         if(strlen(buf) > 1)
  149.         {
  150.             printf("wlist::wbuild() buffer corrupted %s\n",buf);
  151.         }
  152.         ts->Tstring(buf);
  153.         wl->NextData(ts);
  154.     }
  155.  
  156.     return wl;
  157. }
  158. //-------------------------------------------------------------------------
  159. // test_FirstData
  160. //-------------------------------------------------------------------------
  161. int test_FirstData(){
  162.     char    *function    =    "FirstData";
  163.     tstring *ts;
  164.     wlist *wl;
  165.     int pass=TRUE;
  166.     int passall=TRUE;
  167.     char    *result;
  168.  
  169.     wl=new wlist;
  170.     wl->SetPrintData(print_tstring);
  171.  
  172.     //-----------------------------------------------------------------
  173.     // test with empty list
  174.     //-----------------------------------------------------------------
  175.     result=(char *)wl->FirstData("AA");
  176.     if(result==(char *)0 ||!streql(result,"AA"))
  177.     {
  178.         PROBLEM("empty list ");
  179.         pass=FALSE;
  180.     }
  181.     result = (char *)wl->FirstData();
  182.     if(!streql(result,"AA"))
  183.     {
  184.         PROBLEM("empty list ");
  185.         pass=FALSE;
  186.     }
  187.     if(wl->Size() != 1)
  188.     {
  189.         PROBLEM("empty list ");
  190.         pass=FALSE;
  191.     }
  192.     result=(char *)wl->CurrentData();
  193.     if(!streql(result,"AA"))
  194.     {
  195.         PROBLEM("empty list ");
  196.         pass=FALSE;
  197.     }
  198.     if(!pass)
  199.     {
  200.         printf("\tfunction %s failed empty list test\n",function);
  201.         passall=FALSE;
  202.         pass=TRUE;
  203.     }
  204.     wl->DeleteAll();
  205.     //-----------------------------------------------------------------
  206.     // test with one nodes in list
  207.     //-----------------------------------------------------------------
  208.     wlbuild(wl,1);
  209.     result=(char *)wl->FirstData("AA");
  210.     if(!streql(result,"AA"))
  211.     {
  212.         PROBLEM("list size 1");
  213.         pass=FALSE;
  214.     }
  215.     result = (char *)wl->FirstData();
  216.     if(!streql(result,"AA"))
  217.     {
  218.         PROBLEM("list size 1");
  219.         pass=FALSE;
  220.     }
  221.     if(wl->Size() != 1)
  222.         pass=FALSE;
  223.  
  224.     result=(char *)wl->CurrentData();
  225.     if(!streql(result,"AA"))
  226.     {
  227.         PROBLEM("list size 1");
  228.         pass=FALSE;
  229.     }
  230.  
  231.     if(!pass)
  232.     {
  233.         printf("\tfunction %s failed 1 element list test\n",function);
  234.         passall=FALSE;
  235.         pass=TRUE;
  236.     }
  237.     wl->DeleteAll();
  238.     //-----------------------------------------------------------------
  239.     // test with 2 nodes in list list
  240.     //-----------------------------------------------------------------
  241.     wlbuild(wl,2);
  242.  
  243.     result=(char *)wl->FirstData("AA");
  244.     if(!streql(result,"AA"))
  245.     {
  246.         PROBLEM("list size 2");
  247.         pass=FALSE;
  248.     }
  249.     result = (char *)wl->FirstData();
  250.     if(!streql(result,"AA"))
  251.     {
  252.         PROBLEM("list size 2");
  253.         pass=FALSE;
  254.     }
  255.     if(wl->Size() != 2)
  256.     {
  257.         PROBLEM("list size 2");
  258.         pass=FALSE;
  259.     }
  260.  
  261.     result=(char *)wl->CurrentData();
  262.     if(!streql(result,"AA"))
  263.     {
  264.         PROBLEM("list size 2");
  265.         pass=FALSE;
  266.     }
  267.     if(!pass)
  268.     {
  269.         printf("\tfunction %s failed 2 element list test\n",function);
  270.         passall=FALSE;
  271.         pass=TRUE;
  272.     }
  273.     wl->DeleteAll();
  274.     return passall;
  275. }
  276. //-------------------------------------------------------------------------
  277. // test_LastData
  278. //-------------------------------------------------------------------------
  279. int test_LastData(){
  280.     char    *function    =    "LastData";
  281.     tstring *ts;
  282.     wlist *wl;
  283.     int pass=TRUE;
  284.     int passall=TRUE;
  285.     char    *result;
  286.  
  287.     wl=new wlist;
  288.     wl->SetPrintData(print_tstring);
  289.  
  290.     //-----------------------------------------------------------------
  291.     // test with empty list
  292.     //-----------------------------------------------------------------
  293.     result=(char *)wl->LastData("AA");
  294.     if(!streql(result,"AA"))
  295.     {
  296.         PROBLEM("empty list ");
  297.         pass=FALSE;
  298.     }
  299.     result = (char *)wl->LastData();
  300.     if(!streql(result,"AA"))
  301.     {
  302.         PROBLEM("empty list ");
  303.         pass=FALSE;
  304.     }
  305.     if(wl->Size() != 1)
  306.     {
  307.         PROBLEM("empty list ");
  308.         pass=FALSE;
  309.     }
  310.     result=(char *)wl->CurrentData();
  311.     if(!streql(result,"AA"))
  312.     {
  313.         PROBLEM("empty list ");
  314.         pass=FALSE;
  315.     }
  316.     if(!pass)
  317.     {
  318.         printf("\tfunction %s failed empty list test\n",function);
  319.         passall=FALSE;
  320.         pass=TRUE;
  321.     }
  322.     wl->DeleteAll();
  323.     //-----------------------------------------------------------------
  324.     // test with one nodes in list
  325.     //-----------------------------------------------------------------
  326.     wlbuild(wl,1);
  327.     result=(char *)wl->LastData("AA");
  328.     if(!streql(result,"AA"))
  329.     {
  330.         PROBLEM("list size 1");
  331.         pass=FALSE;
  332.     }
  333.     result = (char *)wl->LastData();
  334.     if(!streql(result,"AA"))
  335.     {
  336.         PROBLEM("list size 1");
  337.         pass=FALSE;
  338.     }
  339.     if(wl->Size() != 1)
  340.         pass=FALSE;
  341.  
  342.     result=(char *)wl->CurrentData();
  343.     if(!streql(result,"AA"))
  344.     {
  345.         PROBLEM("list size 1");
  346.         pass=FALSE;
  347.     }
  348.  
  349.     if(!pass)
  350.     {
  351.         printf("\tfunction %s failed 1 element list test\n",function);
  352.         passall=FALSE;
  353.         pass=TRUE;
  354.     }
  355.     wl->DeleteAll();
  356.     //-----------------------------------------------------------------
  357.     // test with 2 nodes in list list
  358.     //-----------------------------------------------------------------
  359.     wlbuild(wl,2);
  360.  
  361.     result=(char *)wl->LastData("AA");
  362.     if(!streql(result,"AA"))
  363.     {
  364.         PROBLEM("list size 2");
  365.         pass=FALSE;
  366.     }
  367.     result = (char *)wl->LastData();
  368.     if(!streql(result,"AA"))
  369.     {
  370.         PROBLEM("list size 2");
  371.         pass=FALSE;
  372.     }
  373.     if(wl->Size() != 2)
  374.     {
  375.         PROBLEM("list size 2");
  376.         pass=FALSE;
  377.     }
  378.  
  379.     result=(char *)wl->CurrentData();
  380.     if(!streql(result,"AA"))
  381.     {
  382.         PROBLEM("list size 2");
  383.         pass=FALSE;
  384.     }
  385.     if(!pass)
  386.     {
  387.         printf("\tfunction %s failed 2 element list test\n",function);
  388.         passall=FALSE;
  389.         pass=TRUE;
  390.     }
  391.     wl->DeleteAll();
  392.     return passall;
  393. }
  394. //-------------------------------------------------------------------------
  395. // test_CurrentData
  396. //-------------------------------------------------------------------------
  397. int test_CurrentData(){
  398.     char    *function    =    "CurrentData";
  399.     tstring *ts;
  400.     wlist *wl;
  401.     int pass=TRUE;
  402.     int passall=TRUE;
  403.     char    *result;
  404.  
  405.     wl=new wlist;
  406.     wl->SetPrintData(print_tstring);
  407.  
  408.     //-----------------------------------------------------------------
  409.     // test with empty list
  410.     //-----------------------------------------------------------------
  411.     result=(char *)wl->CurrentData();
  412.     if(result != (char *)0)
  413.     {
  414.         pass=FALSE;
  415.         PROBLEM("empty list");
  416.     }
  417.     if(wl->Size() != 0)
  418.     {
  419.         pass=FALSE;
  420.         PROBLEM("empty list");
  421.     }
  422.     result=(char *)wl->CurrentData("AA");
  423.     if(!streql(result,"AA"))
  424.     {
  425.         pass=FALSE;
  426.         PROBLEM("empty list after insertion");
  427.     }
  428.     result=(char *)wl->CurrentData();
  429.     if(!streql(result,"AA"))
  430.     {
  431.         pass=FALSE;
  432.         PROBLEM("empty list after insertion");
  433.     }
  434.     if(wl->Size() != 1)
  435.     {
  436.         pass=FALSE;
  437.         PROBLEM("empty list after insertion");
  438.     }
  439.     result = (char *)wl->CurrentData("BB");
  440.     if(!streql(result,"BB"))
  441.     {
  442.         pass=FALSE;
  443.         PROBLEM("empty list after insertion");
  444.     }
  445.     if(!pass)
  446.     {
  447.         printf("\tfunction %s failed empty list test\n",function);
  448.         passall=FALSE;
  449.         pass=TRUE;
  450.     }
  451.     wl->DeleteAll();
  452.     //-----------------------------------------------------------------
  453.     // test with one nodes in list
  454.     //-----------------------------------------------------------------
  455.     wlbuild(wl,1);
  456.     ts=(tstring *)wl->CurrentData();
  457.     result=(char *)ts->Tstring();
  458.     if(!streql(result,"1"))
  459.     {
  460.         pass=FALSE;
  461.         PROBLEM("list size 1");
  462.     }
  463.     result=(char *)wl->CurrentData("AA");
  464.     if(!streql(result,"AA"))
  465.     {
  466.         pass=FALSE;
  467.         PROBLEM("list size 1");
  468.     }
  469.     result=(char *)wl->CurrentData();
  470.     if(!streql(result,"AA"))
  471.     {
  472.         pass=FALSE;
  473.         PROBLEM("list size 1");
  474.     }
  475.     if(!pass)
  476.     {
  477.         printf("\tfunction %s failed 1 element list test\n",function);
  478.         passall=FALSE;
  479.         pass=TRUE;
  480.     }
  481.     wl->DeleteAll();
  482.     //-----------------------------------------------------------------
  483.     // test with 2 nodes in list list
  484.     //-----------------------------------------------------------------
  485.     wlbuild(wl,2);
  486.     ts=(tstring *)wl->CurrentData();
  487.     result=ts->Tstring();
  488.     if(!streql(result,"2"))
  489.     {
  490.         pass=FALSE;
  491.         PROBLEM("list size 1");
  492.         printf("length %d\n",strlen(result));
  493.         for(int ii=0; ii <= strlen(result); ii++)
  494.             printf("%d  ",result[ii]);
  495.         printf("\n");
  496.         printf("result=%s\n\n",result);
  497.         wl->print();
  498.     }
  499.  
  500.     if(!pass)
  501.     {
  502.         printf("\tfunction %s failed 2 element list test\n",function);
  503.         passall=FALSE;
  504.         pass=TRUE;
  505.     }
  506.     wl->DeleteAll();
  507.     return passall;
  508. }
  509. //-------------------------------------------------------------------------
  510. // test_NextData()
  511. //-------------------------------------------------------------------------
  512. int test_NextData(){
  513.     char    *function    =    "NextData";
  514.     tstring *ts;
  515.     wlist *wl;
  516.     int pass=TRUE;
  517.     int passall=TRUE;
  518.     char    *result;
  519.  
  520.     wl=new wlist;
  521.     wl->SetPrintData(print_tstring);
  522.  
  523.     //-----------------------------------------------------------------
  524.     // test with empty list
  525.     //-----------------------------------------------------------------
  526.     result=(char *)wl->NextData();
  527.     if(result != (char *)0)
  528.     {
  529.         PROBLEM("NextData empty list");
  530.         pass=FALSE;
  531.     }
  532.  
  533.     result=(char *)wl->NextData("AA");
  534.     if(!streql(result,"AA"))
  535.     {
  536.         PROBLEM("NextData - empty list");
  537.         pass=FALSE;
  538.     }
  539.     if(wl->Size() != 1)
  540.     {
  541.         PROBLEM("NextData - empty list");
  542.         pass=FALSE;
  543.     }
  544.     result=(char *)wl->CurrentData();
  545.     if(!streql(result,"AA"))
  546.     {
  547.         PROBLEM("NextData empty list");
  548.         pass=FALSE;
  549.     }
  550.  
  551.     if(!pass)
  552.     {
  553.         printf("\tfunction %s failed empty list test\n",function);
  554.         passall=FALSE;
  555.         pass=TRUE;
  556.     }
  557.     wl->DeleteAll();
  558.     //-----------------------------------------------------------------
  559.     // test with one nodes in list
  560.     //-----------------------------------------------------------------
  561.     wlbuild(wl,1);
  562.     result=(char *)wl->NextData();
  563.     if(result != (char *)0)
  564.     {
  565.         PROBLEM("NextData list size 1");
  566.         pass=FALSE;
  567.     }
  568.     ts = (tstring *)wl->CurrentData();
  569.     result=(char *)ts->Tstring();
  570.     if(!streql(result,"1"))
  571.     {
  572.         PROBLEM("NextData list size 1");
  573.         pass=FALSE;
  574.     }
  575.     result=(char *)wl->NextData("AA");
  576.     if(!streql(result,"AA"))
  577.     {
  578.         PROBLEM("NextData list size 1");
  579.         pass=FALSE;
  580.     }
  581.     result=(char *)wl->LastData();
  582.     if(!streql(result,"AA"))
  583.     {
  584.         PROBLEM("NextData list size 1");
  585.         pass=FALSE;
  586.     }
  587.     result=(char *)wl->CurrentData();
  588.     if(!streql(result,"AA"))
  589.     {
  590.         PROBLEM("NextData list size 1");
  591.         pass=FALSE;
  592.     }
  593.     ts=(tstring *)wl->FirstData();
  594.     result=(char *)ts->Tstring();
  595.     if(!streql(result,"1"))
  596.     {
  597.         PROBLEM("NextData list size 1");
  598.         pass=FALSE;
  599.     }
  600.     ts=(tstring *)wl->CurrentData();
  601.     result=(char *)ts->Tstring();
  602.     if(!streql(result,"1"))
  603.     {
  604.         PROBLEM("NextData list size 1");
  605.         pass=FALSE;
  606.     }
  607.     if(wl->Size() != 2)
  608.     {
  609.         PROBLEM("NextData list size 1");
  610.         pass=FALSE;
  611.     }
  612.     if(!pass)
  613.     {
  614.         printf("\tfunction %s failed 1 element list test\n",function);
  615.         passall=FALSE;
  616.         pass=TRUE;
  617.     }
  618.     wl->DeleteAll();
  619.     //-----------------------------------------------------------------
  620.     // test with 2 nodes in list list
  621.     //-----------------------------------------------------------------
  622.     wlbuild(wl,2);
  623.     result=(char *)wl->NextData();
  624.     if(result != (char *)0)
  625.     {
  626.         PROBLEM("NextData list size 2");
  627.         pass=FALSE;
  628.     }
  629.     result=(char *)wl->NextData("AA");
  630.     if(!streql(result,"AA"))
  631.     {
  632.         PROBLEM("NextData list size 2");
  633.         pass=FALSE;
  634.     }
  635.     result=(char *)wl->CurrentData();
  636.     if(!streql(result,"AA"))
  637.     {
  638.         PROBLEM("NextData list size 2");
  639.         pass=FALSE;
  640.     }
  641.     result=(char *)wl->LastData();
  642.     if(!streql(result,"AA"))
  643.     {
  644.         PROBLEM("NextData list size 2");
  645.         pass=FALSE;
  646.     }
  647.     if(wl->Size() != 3)
  648.     {
  649.         PROBLEM("NextData list size 2");
  650.         pass=FALSE;
  651.     }
  652.     wl->FirstData();
  653.     ts=(tstring *)wl->NextData();
  654.     result=(char *)ts->Tstring();
  655.     if(!streql(result,"2"))
  656.     {
  657.         PROBLEM("NextData list size 2");
  658.         pass=FALSE;
  659.     }
  660.     ts=(tstring *)wl->FirstData();
  661.     result=(char *)ts->Tstring();
  662.     if(!streql(result,"1"))
  663.     {
  664.         PROBLEM("NextData list size 2");
  665.         pass=FALSE;
  666.     }
  667.     result=(char *)wl->NextData("BB");
  668.     if(!streql(result,"BB"))
  669.     {
  670.         PROBLEM("NextData list size 2");
  671.         pass=FALSE;
  672.     }
  673.     wl->LastData();
  674.     result=(char *)wl->PreviousData();
  675.     if(!streql(result,"BB"))
  676.     {
  677.         PROBLEM("NextData list size 2");
  678.         pass=FALSE;
  679.     }
  680.     wl->LastData();
  681.     result=(char *)wl->NextData();
  682.     if(result != (char *)0)
  683.     {
  684.         PROBLEM("NextData list size 2");
  685.         pass=FALSE;
  686.     }
  687.     result=(char *)wl->NextData("CCC");
  688.     if(!streql(result,"CCC"))
  689.     {
  690.         PROBLEM("NextData list size 2");
  691.         pass=FALSE;
  692.     }
  693.     result=(char *)wl->LastData();
  694.     if(!streql(result,"CCC"))
  695.     {
  696.         PROBLEM("NextData list size 2");
  697.         pass=FALSE;
  698.     }
  699.     if(wl->Size() != 4)
  700.     {
  701.         PROBLEM("NextData list size 2");
  702.         pass=FALSE;
  703.     }
  704.     if(!pass)
  705.     {
  706.         printf("\tfunction %s failed 2 element list test\n",function);
  707.         passall=FALSE;
  708.         pass=TRUE;
  709.     }
  710.     wl->DeleteAll();
  711.     return passall;
  712. }
  713. //-------------------------------------------------------------------------
  714. // test_PreviousData
  715. //-------------------------------------------------------------------------
  716. int test_PreviousData(){
  717.     char    *function    =    "PreviousData";
  718.     tstring *ts;
  719.     wlist *wl;
  720.     int pass=TRUE;
  721.     int passall=TRUE;
  722.     char    *result;
  723.  
  724.     wl=new wlist;
  725.     wl->SetPrintData(print_tstring);
  726.  
  727.     //-----------------------------------------------------------------
  728.     // test with empty list
  729.     //-----------------------------------------------------------------
  730.     result=(char *)wl->PreviousData();
  731.     if(result != (char *)0)
  732.     {
  733.         PROBLEM("PreviousData list size 0");
  734.         pass=FALSE;
  735.     }
  736.     result=(char *)wl->PreviousData("AAA");
  737.     if(!streql(result,"AAA"))
  738.     {
  739.         PROBLEM("PreviousData list size 0");
  740.         pass=FALSE;
  741.     }
  742.     if(wl->Size() != 1)
  743.     {
  744.         PROBLEM("PreviousData list size 0");
  745.         pass=FALSE;
  746.     }
  747.     result=(char *)wl->CurrentData();
  748.     if(!streql(result,"AAA"))
  749.     {
  750.         PROBLEM("PreviousData list size 0");
  751.         pass=FALSE;
  752.     }
  753.     result=(char *)wl->FirstData();
  754.     if(!streql(result,"AAA"))
  755.     {
  756.         PROBLEM("PreviousData list size 0");
  757.         pass=FALSE;
  758.     }
  759.     result=(char *)wl->LastData();
  760.     if(!streql(result,"AAA"))
  761.     {
  762.         PROBLEM("PreviousData list size 0");
  763.         pass=FALSE;
  764.     }
  765.     if(!pass)
  766.     {
  767.         printf("\tfunction %s failed empty list test\n",function);
  768.         passall=FALSE;
  769.         pass=TRUE;
  770.     }
  771.     wl->DeleteAll();
  772.     //-----------------------------------------------------------------
  773.     // test with one nodes in list
  774.     //-----------------------------------------------------------------
  775.     wlbuild(wl,1);
  776.     ts=(tstring *)wl->PreviousData();
  777.     if(ts != (tstring *)0)
  778.     {
  779.         PROBLEM("PreviousData list size 1");
  780.         pass=FALSE;
  781.     }
  782.     result=(char *)wl->PreviousData("b");
  783.     if(!streql(result,"b"))
  784.     {
  785.         PROBLEM("PreviousData list size 1");
  786.         pass=FALSE;
  787.     }
  788.     if(wl->Size() != 2)
  789.     {
  790.         PROBLEM("PreviousData list size 1");
  791.         pass=FALSE;
  792.     }
  793.     result=(char *)wl->FirstData();
  794.     if(!streql(result,"b"))
  795.     {
  796.         PROBLEM("PreviousData list size 1");
  797.         pass=FALSE;
  798.     }
  799.     ts=(tstring *)wl->LastData();
  800.     result=(char *)ts->Tstring();
  801.     if(!streql(result,"1"))
  802.     {
  803.         PROBLEM("PreviousData list size 1");
  804.         pass=FALSE;
  805.     }
  806.     if(!pass)
  807.     {
  808.         printf("\tfunction %s failed 1 element list test\n",function);
  809.         passall=FALSE;
  810.         pass=TRUE;
  811.     }
  812.     wl->DeleteAll();
  813.     //-----------------------------------------------------------------
  814.     // test with 2 nodes in list list
  815.     //-----------------------------------------------------------------
  816.     wlbuild(wl,2);
  817.     ts=(tstring *)wl->PreviousData();
  818.     result=(char *)ts->Tstring();
  819.     if(!streql(result,"1"))
  820.     {
  821.         PROBLEM("PreviousData list size 2");
  822.         pass=FALSE;
  823.     }
  824.     ts=(tstring *)wl->LastData();
  825.     result=(char *)ts->Tstring();
  826.     if(!streql(result,"2"))
  827.     {
  828.         PROBLEM("PreviousData list size 2");
  829.         pass=FALSE;
  830.     }
  831.     result=(char *)wl->PreviousData("A");
  832.     if(!streql(result,"A"))
  833.     {
  834.         PROBLEM("PreviousData list size 2");
  835.         pass=FALSE;
  836.     }
  837.     result=(char *)wl->FirstData();
  838.     if(!streql(result,"A"))
  839.     {
  840.         PROBLEM("PreviousData list size 2");
  841.         pass=FALSE;
  842.     }
  843.     if(!pass)
  844.     {
  845.         printf("\tfunction %s failed 2 element list test\n",function);
  846.         passall=FALSE;
  847.         pass=TRUE;
  848.     }
  849.     wl->DeleteAll();
  850.     //-----------------------------------------------------------------
  851.     // test with 3 nodes in list
  852.     //-----------------------------------------------------------------
  853.     wlbuild(wl,3);
  854.     ts=(tstring *)wl->PreviousData();
  855.     result=(char *)ts->Tstring();
  856.     if(!streql(result,"2"))
  857.     {
  858.         PROBLEM("PreviousData list size 3");
  859.         pass=FALSE;
  860.     }
  861.     wl->LastData();
  862.     result=(char *)wl->PreviousData("c");
  863.     if(!streql(result,"c"))
  864.     {
  865.         PROBLEM("PreviousData list size 3");
  866.         pass=FALSE;
  867.     }
  868.     wl->FirstData();
  869.     result=(char *)wl->NextData();
  870.     if(!streql(result,"c"))
  871.     {
  872.         PROBLEM("PreviousData list size 3");
  873.         pass=FALSE;
  874.     }
  875.     
  876.     if(!pass)
  877.     {
  878.         printf("\tfunction %s failed 3 element list test\n",function);
  879.         passall=FALSE;
  880.         pass=TRUE;
  881.     }
  882.     wl->DeleteAll();
  883.     return passall;
  884. }
  885. //-------------------------------------------------------------------------
  886. // test_PrependData
  887. //-------------------------------------------------------------------------
  888. int test_PrependData(){
  889.     char    *function    =    "PrependData";
  890.     tstring *ts;
  891.     wlist *wl;
  892.     int pass=TRUE;
  893.     int passall=TRUE;
  894.     char    *result;
  895.  
  896.     wl=new wlist;
  897.     wl->SetPrintData(print_tstring);
  898.  
  899.     //-----------------------------------------------------------------
  900.     // test with empty list
  901.     //-----------------------------------------------------------------
  902.     result=(char *)wl->PrependData("bb");
  903.     if(!streql(result,"bb"))
  904.     {
  905.         PROBLEM("PrependData list size 0");
  906.         pass=FALSE;
  907.     }
  908.     result=(char *)wl->CurrentData();
  909.     if(!streql(result,"bb"))
  910.     {
  911.         PROBLEM("PrependData list size 0");
  912.         pass=FALSE;
  913.     }
  914.     if(!pass)
  915.     {
  916.         printf("\tfunction %s failed empty list test\n",function);
  917.         passall=FALSE;
  918.         pass=TRUE;
  919.     }
  920.     wl->DeleteAll();
  921.     //-----------------------------------------------------------------
  922.     // test with one nodes in list
  923.     //-----------------------------------------------------------------
  924.     wlbuild(wl,1);
  925.     result=(char *)wl->PrependData("bb");
  926.     if(!streql(result,"bb"))
  927.     {
  928.         PROBLEM("PrependData list size 0");
  929.         pass=FALSE;
  930.     }
  931.     result=(char *)wl->CurrentData();
  932.     if(!streql(result,"bb"))
  933.     {
  934.         PROBLEM("PrependData list size 0");
  935.         pass=FALSE;
  936.     }
  937.  
  938.     if(!pass)
  939.     {
  940.         printf("\tfunction %s failed 1 element list test\n",function);
  941.         passall=FALSE;
  942.         pass=TRUE;
  943.     }
  944.     wl->DeleteAll();
  945.     return passall;
  946. }
  947. //-------------------------------------------------------------------------
  948. // test_PreInsert
  949. //-------------------------------------------------------------------------
  950. int test_PreInsert(){
  951.     char    *function    =    "PreInsert";
  952.     tstring *ts;
  953.     wlist *wl;
  954.     int pass=TRUE;
  955.     int passall=TRUE;
  956.     char    *result;
  957.  
  958.     wl=new wlist;
  959.     wl->SetPrintData(print_tstring);
  960.  
  961.     //-----------------------------------------------------------------
  962.     // test with empty list
  963.     //-----------------------------------------------------------------
  964.     result=(char *)wl->PreInsert("bb");
  965.     if(!streql(result,"bb"))
  966.     {
  967.         PROBLEM("PreInsert list size 0");
  968.         pass=FALSE;
  969.     }
  970.     result=(char *)wl->CurrentData();
  971.     if(!streql(result,"bb"))
  972.     {
  973.         PROBLEM("PreInsert list size 0");
  974.         pass=FALSE;
  975.     }
  976.     if(!pass)
  977.     {
  978.         printf("\tfunction %s failed empty list test\n",function);
  979.         passall=FALSE;
  980.         pass=TRUE;
  981.     }
  982.     wl->DeleteAll();
  983.     //-----------------------------------------------------------------
  984.     // test with one nodes in list
  985.     //-----------------------------------------------------------------
  986.     wlbuild(wl,1);
  987.     result=(char *)wl->PreInsert("bb");
  988.     if(!streql(result,"bb"))
  989.     {
  990.         PROBLEM("PreInsert list size 1");
  991.         pass=FALSE;
  992.     }
  993.     result=(char *)wl->CurrentData();
  994.     if(!streql(result,"bb"))
  995.     {
  996.         PROBLEM("PreInsert list size 1");
  997.         pass=FALSE;
  998.     }
  999.     if(wl->Size() != 2)
  1000.     {
  1001.         PROBLEM("PreInsert list size 1");
  1002.         pass=FALSE;
  1003.     }
  1004.     result=(char *)wl->FirstData();
  1005.     if(!streql(result,"bb"))
  1006.     {
  1007.         PROBLEM("PreInsert list size 1");
  1008.         pass=FALSE;
  1009.     }
  1010.     ts=(tstring *)wl->LastData();
  1011.     result=(char *)ts->Tstring();
  1012.     if(!streql(result,"1"))
  1013.     {
  1014.         PROBLEM("PreInsert list size 1");
  1015.         pass=FALSE;
  1016.     }
  1017.     if(!pass)
  1018.     {
  1019.         printf("\tfunction %s failed 1 element list test\n",function);
  1020.         passall=FALSE;
  1021.         pass=TRUE;
  1022.     }
  1023.     wl->DeleteAll();
  1024.     //-----------------------------------------------------------------
  1025.     // test with 3 nodes in list
  1026.     //-----------------------------------------------------------------
  1027.     wlbuild(wl,3);
  1028.     result=(char *)wl->PreInsert("bb");
  1029.     if(!streql(result,"bb"))
  1030.     {
  1031.         PROBLEM("PreInsert list size 3");
  1032.         pass=FALSE;
  1033.     }
  1034.     ts=(tstring *)wl->LastData();
  1035.     result=ts->Tstring();
  1036.     if(!streql(result,"3"))
  1037.     {
  1038.         PROBLEM("PreInsert list size 3");
  1039.         pass=FALSE;
  1040.     }
  1041.     result=(char *)wl->PreviousData();
  1042.     if(!streql(result,"bb"))
  1043.     {
  1044.         PROBLEM("PreInsert list size 3");
  1045.         pass=FALSE;
  1046.     }
  1047.     if(wl->Size() != 4)
  1048.     {
  1049.         PROBLEM("PreInsert list size 3");
  1050.         pass=FALSE;
  1051.     }
  1052.     if(!pass)
  1053.     {
  1054.         printf("\tfunction %s failed 3 element list test\n",function);
  1055.         passall=FALSE;
  1056.         pass=TRUE;
  1057.     }
  1058.     wl->DeleteAll();
  1059.     return passall;
  1060. }
  1061. //-------------------------------------------------------------------------
  1062. // test_PostInsert
  1063. //-------------------------------------------------------------------------
  1064. int test_PostInsert(){
  1065.     char    *function    =    "PostInsert";
  1066.     tstring *ts;
  1067.     wlist *wl;
  1068.     int pass=TRUE;
  1069.     int passall=TRUE;
  1070.     char    *result;
  1071.  
  1072.     wl=new wlist;
  1073.     wl->SetPrintData(print_tstring);
  1074.  
  1075.     //-----------------------------------------------------------------
  1076.     // test with empty list
  1077.     //-----------------------------------------------------------------
  1078.     result=(char *)wl->PostInsert("bb");
  1079.     if(!streql(result,"bb"))
  1080.     {
  1081.         PROBLEM("PostInsert list size 0");
  1082.         pass=FALSE;
  1083.     }
  1084.     result=(char *)wl->CurrentData();
  1085.     if(!streql(result,"bb"))
  1086.     {
  1087.         PROBLEM("PostInsert list size 0");
  1088.         pass=FALSE;
  1089.     }
  1090.     result=(char *)wl->FirstData();
  1091.     if(!streql(result,"bb"))
  1092.     {
  1093.         PROBLEM("PostInsert list size 0");
  1094.         pass=FALSE;
  1095.     }
  1096.     result=(char *)wl->LastData();
  1097.     if(!streql(result,"bb"))
  1098.     {
  1099.         PROBLEM("PostInsert list size 0");
  1100.         pass=FALSE;
  1101.     }
  1102.     if(wl->Size() != 1)
  1103.     {
  1104.         PROBLEM("PostInsert list size 0");
  1105.         pass=FALSE;
  1106.     }
  1107.     if(!pass)
  1108.     {
  1109.         printf("\tfunction %s failed empty list test\n",function);
  1110.         passall=FALSE;
  1111.         pass=TRUE;
  1112.     }
  1113.     wl->DeleteAll();
  1114.     //-----------------------------------------------------------------
  1115.     // test with one nodes in list
  1116.     //-----------------------------------------------------------------
  1117.     wlbuild(wl,1);
  1118.     result=(char *)wl->PostInsert("bb");
  1119.     if(!streql(result,"bb"))
  1120.     {
  1121.         PROBLEM("PostInsert list size 1");
  1122.         pass=FALSE;
  1123.     }
  1124.     result=(char *)wl->CurrentData();
  1125.     if(!streql(result,"bb"))
  1126.     {
  1127.         PROBLEM("PostInsert list size 1");
  1128.         pass=FALSE;
  1129.     }
  1130.     ts=(tstring *)wl->FirstData();
  1131.     result=(char *)ts->Tstring();
  1132.     if(!streql(result,"1"))
  1133.     {
  1134.         printf("\tresult: %s\n",result);
  1135.         PROBLEM("PostInsert list size 1");
  1136.         pass=FALSE;
  1137.     }
  1138.     result=(char *)wl->NextData();
  1139.     if(!streql(result,"bb"))
  1140.     {
  1141.         PROBLEM("PostInsert list size 1");
  1142.         pass=FALSE;
  1143.     }
  1144.     result=(char *)wl->NextData();
  1145.     if(result != (char *)0)
  1146.     {
  1147.         PROBLEM("PostInsert list size 1");
  1148.         pass=FALSE;
  1149.     }
  1150.     result=(char *)wl->LastData();
  1151.     if(!streql(result,"bb"))
  1152.     {
  1153.         PROBLEM("PostInsert list size 1");
  1154.         pass=FALSE;
  1155.     }
  1156.     if(wl->Size() != 2)
  1157.     {
  1158.         PROBLEM("PostInsert list size 0");
  1159.         pass=FALSE;
  1160.     }
  1161.  
  1162.     if(!pass)
  1163.     {
  1164.         printf("\tfunction %s failed 1 element list test\n",function);
  1165.         passall=FALSE;
  1166.         pass=TRUE;
  1167.     }
  1168.     wl->DeleteAll();
  1169.     return passall;
  1170. }
  1171. //-------------------------------------------------------------------------
  1172. // test_DeleteCurrent
  1173. //-------------------------------------------------------------------------
  1174. int test_DeleteCurrent(){
  1175.     char    *function    =    "DeleteCurrent";
  1176.     tstring *ts;
  1177.     wlist *wl;
  1178.     int pass=TRUE;
  1179.     int passall=TRUE;
  1180.     char    *result;
  1181.  
  1182.     wl=new wlist;
  1183.     wl->SetPrintData(print_tstring);
  1184.  
  1185.     //-----------------------------------------------------------------
  1186.     // test with empty list
  1187.     //-----------------------------------------------------------------
  1188.     ts=(tstring *)wl->DeleteCurrent();
  1189.     if(ts != (tstring *)0)
  1190.     {
  1191.         PROBLEM("DeleteCurrent list size 0");
  1192.         pass=FALSE;
  1193.     }
  1194.     if(!pass)
  1195.     {
  1196.         printf("\tfunction %s failed empty list test\n",function);
  1197.         passall=FALSE;
  1198.         pass=TRUE;
  1199.     }
  1200.     wl->DeleteAll();
  1201.     //-----------------------------------------------------------------
  1202.     // test with one nodes in list
  1203.     //-----------------------------------------------------------------
  1204.     wlbuild(wl,1);
  1205.     ts=(tstring *)wl->DeleteCurrent();
  1206.     result=ts->Tstring();
  1207.     if(!streql(result,"1"))
  1208.     {
  1209.         PROBLEM("DeleteCurrent list size 1");
  1210.         pass=FALSE;
  1211.     }
  1212.     if(wl->Size() != 0)
  1213.     {
  1214.         PROBLEM("DeleteCurrent list size 1");
  1215.         pass=FALSE;
  1216.     }
  1217.     if(!pass)
  1218.     {
  1219.         printf("\tfunction %s failed 1 element list test\n",function);
  1220.         passall=FALSE;
  1221.         pass=TRUE;
  1222.     }
  1223.     wl->DeleteAll();
  1224.     //-----------------------------------------------------------------
  1225.     // test with 2 nodes in list list
  1226.     //-----------------------------------------------------------------
  1227.     wlbuild(wl,2);
  1228.     ts=(tstring *)wl->DeleteCurrent();
  1229.     result=ts->Tstring();
  1230.     if(!streql(result,"2"))
  1231.     {
  1232.         PROBLEM("DeleteCurrent list size 2");
  1233.         pass=FALSE;
  1234.     }
  1235.     ts=(tstring *)wl->DeleteCurrent();
  1236.     result=ts->Tstring();
  1237.     if(!streql(result,"1"))
  1238.     {
  1239.         PROBLEM("DeleteCurrent list size 2");
  1240.         pass=FALSE;
  1241.     }
  1242.  
  1243.     if(!pass)
  1244.     {
  1245.         printf("\tfunction %s failed 2 element list test\n",function);
  1246.         passall=FALSE;
  1247.         pass=TRUE;
  1248.     }
  1249.     wl->DeleteAll();
  1250.     //-----------------------------------------------------------------
  1251.     // test with 3 nodes in list
  1252.     //-----------------------------------------------------------------
  1253.     wlbuild(wl,3);
  1254.     wl->PreviousData();
  1255.     ts=(tstring *)wl->DeleteCurrent();
  1256.     result=ts->Tstring();
  1257.     if(!streql(result,"2"))
  1258.     {
  1259.         PROBLEM("DeleteCurrent list size 2");
  1260.         pass=FALSE;
  1261.     }
  1262.     ts=(tstring *)wl->CurrentData();
  1263.     result=ts->Tstring();
  1264.     if(!streql(result,"3"))
  1265.     {
  1266.         PROBLEM("DeleteCurrent list size 2");
  1267.         pass=FALSE;
  1268.     }
  1269.     wl->DeleteAll();
  1270.     wlbuild(wl,3);
  1271.     ts=(tstring *)wl->DeleteCurrent();
  1272.     result=ts->Tstring();
  1273.     if(!streql(result,"3"))
  1274.     {
  1275.         PROBLEM("DeleteCurrent list size 2");
  1276.         pass=FALSE;
  1277.     }
  1278.     ts=(tstring *)wl->CurrentData();
  1279.     result=ts->Tstring();
  1280.     if(!streql(result,"2"))
  1281.     {
  1282.         PROBLEM("DeleteCurrent list size 2");
  1283.         pass=FALSE;
  1284.     }
  1285.  
  1286.     wl->DeleteAll();
  1287.     wlbuild(wl,3);
  1288.     wl->FirstData();
  1289.     ts=(tstring *)wl->DeleteCurrent();
  1290.     result=ts->Tstring();
  1291.     if(!streql(result,"1"))
  1292.     {
  1293.         PROBLEM("DeleteCurrent list size 2");
  1294.         pass=FALSE;
  1295.     }
  1296.     ts=(tstring *)wl->CurrentData();
  1297.     result=ts->Tstring();
  1298.     if(!streql(result,"2"))
  1299.     {
  1300.         PROBLEM("DeleteCurrent list size 2");
  1301.         pass=FALSE;
  1302.     }
  1303.  
  1304.     if(!pass)
  1305.     {
  1306.         printf("\tfunction %s failed 3 element list test\n",function);
  1307.         passall=FALSE;
  1308.         pass=TRUE;
  1309.     }
  1310.     wl->DeleteAll();
  1311.     return passall;
  1312. }
  1313. //-------------------------------------------------------------------------
  1314. // test_Reverse
  1315. //-------------------------------------------------------------------------
  1316. int test_Reverse(){
  1317.     char    *function    =    "Reverse";
  1318.     tstring *ts;
  1319.     wlist *wl;
  1320.     int pass=TRUE;
  1321.     int passall=TRUE;
  1322.     char    *result;
  1323.     wlist *wl2;
  1324.  
  1325.     wl=new wlist;
  1326.     wl->SetPrintData(print_tstring);
  1327.     wl->SetCompareData(compare_tstring);
  1328.  
  1329.     //-----------------------------------------------------------------
  1330.     // test with empty list
  1331.     //-----------------------------------------------------------------
  1332.     wl2=wl->Reverse();
  1333.     if(!pass)
  1334.     {
  1335.         printf("\tfunction %s failed empty list test\n",function);
  1336.         passall=FALSE;
  1337.         pass=TRUE;
  1338.     }
  1339.     wl->DeleteAll();
  1340.     //-----------------------------------------------------------------
  1341.     // test with one nodes in list
  1342.     //-----------------------------------------------------------------
  1343.     wlbuild(wl,1);
  1344.     wl2=wl->Reverse();
  1345.     ts=(tstring *)wl2->FirstData();
  1346.     result=ts->Tstring();
  1347.     if(!streql(result,"1"))
  1348.     {
  1349.         PROBLEM("Reverse() list size 1");
  1350.         pass=FALSE;
  1351.     }
  1352.     ts=(tstring *)wl2->NextData();
  1353.     if(ts != (tstring *)0)
  1354.     {
  1355.         PROBLEM("Reverse() list size 1");
  1356.         pass=FALSE;
  1357.     }
  1358.     if(!pass)
  1359.     {
  1360.         printf("\tfunction %s failed 1 element list test\n",function);
  1361.         passall=FALSE;
  1362.         pass=TRUE;
  1363.     }
  1364.     wl->DeleteAll();
  1365.     wl2->DeleteAll();
  1366.     //-----------------------------------------------------------------
  1367.     // test with 2 nodes in list list
  1368.     //-----------------------------------------------------------------
  1369.     wlbuild(wl,2);
  1370.     wl2=wl->Reverse();
  1371.     ts=(tstring *)wl2->FirstData();
  1372.     result=ts->Tstring();
  1373.     if(!streql(result,"2"))
  1374.     {
  1375.         PROBLEM("Reverse() list size 2");
  1376.         pass=FALSE;
  1377.     }
  1378.     ts=(tstring *)wl2->NextData();
  1379.     result=ts->Tstring();
  1380.     if(!streql(result,"1"))
  1381.     {
  1382.         PROBLEM("Reverse() list size 2");
  1383.         pass=FALSE;
  1384.     }
  1385.     ts=(tstring *)wl2->NextData();
  1386.     if(ts != (tstring *)0)
  1387.     {
  1388.         PROBLEM("Reverse() list size 1");
  1389.         pass=FALSE;
  1390.     }
  1391.     if(!pass)
  1392.     {
  1393.         printf("\tfunction %s failed 2 element list test\n",function);
  1394.         passall=FALSE;
  1395.         pass=TRUE;
  1396.     }
  1397.     wl->DeleteAll();
  1398.     wl2->DeleteAll();
  1399.     //-----------------------------------------------------------------
  1400.     // test with 3 nodes in list
  1401.     //-----------------------------------------------------------------
  1402.     wlbuild(wl,3);
  1403.     wl2=wl->Reverse();
  1404.     ts=(tstring *)wl2->FirstData();
  1405.     result=ts->Tstring();
  1406.     if(!streql(result,"3"))
  1407.     {
  1408.         PROBLEM("Reverse() list size 3");
  1409.         pass=FALSE;
  1410.     }
  1411.     ts=(tstring *)wl2->NextData();
  1412.     result=ts->Tstring();
  1413.     if(!streql(result,"2"))
  1414.     {
  1415.         PROBLEM("Reverse() list size 3");
  1416.         pass=FALSE;
  1417.     }
  1418.     ts=(tstring *)wl2->NextData();
  1419.     result=ts->Tstring();
  1420.     if(!streql(result,"1"))
  1421.     {
  1422.         PROBLEM("Reverse() list size 3");
  1423.         pass=FALSE;
  1424.     }
  1425.     ts=(tstring *)wl2->NextData();
  1426.     if(ts != (tstring *)0)
  1427.     {
  1428.         PROBLEM("Reverse() list size 3");
  1429.         pass=FALSE;
  1430.     }
  1431.  
  1432.  
  1433.     if(!pass)
  1434.     {
  1435.         printf("\tfunction %s failed 3 element list test\n",function);
  1436.         passall=FALSE;
  1437.         pass=TRUE;
  1438.     }
  1439.     wl->DeleteAll();
  1440.     wl2->DeleteAll();
  1441.     return passall;
  1442. }
  1443. //-------------------------------------------------------------------------
  1444. // test_ExchangePrevious
  1445. //-------------------------------------------------------------------------
  1446. int test_ExchangePrevious(){
  1447.     char    *function    =    "ExchangePrevious";
  1448.     tstring *ts;
  1449.     wlist *wl;
  1450.     int pass=TRUE;
  1451.     int passall=TRUE;
  1452.     char    *result;
  1453.  
  1454.     wl=new wlist;
  1455.     wl->SetPrintData(print_tstring);
  1456.     wl->SetCompareData(compare_tstring);
  1457.  
  1458.     //-----------------------------------------------------------------
  1459.     // test with empty list
  1460.     //-----------------------------------------------------------------
  1461.     ts = (tstring *)wl->ExchangePrevious();
  1462.     if(ts != (tstring *)0)
  1463.     {
  1464.         PROBLEM("ExchangePrevious empty list");
  1465.         pass=FALSE;
  1466.     }
  1467.     if(!pass)
  1468.     {
  1469.         printf("\tfunction %s failed empty list test\n",function);
  1470.         passall=FALSE;
  1471.         pass=TRUE;
  1472.     }
  1473.     wl->DeleteAll();
  1474.     //-----------------------------------------------------------------
  1475.     // test with one nodes in list
  1476.     //-----------------------------------------------------------------
  1477.     wlbuild(wl,1);
  1478.     ts=(tstring *)wl->ExchangePrevious();
  1479.     if(ts != (tstring *)0)
  1480.     {
  1481.         PROBLEM("ExchangePrevious list size 1");
  1482.         pass=FALSE;
  1483.     }
  1484.     if(!pass)
  1485.     {
  1486.         printf("\tfunction %s failed 1 element list test\n",function);
  1487.         passall=FALSE;
  1488.         pass=TRUE;
  1489.     }
  1490.     wl->DeleteAll();
  1491.     //-----------------------------------------------------------------
  1492.     // test with 2 nodes in list list
  1493.     //-----------------------------------------------------------------
  1494.     wlbuild(wl,2);
  1495.     wl->FirstData();
  1496.     ts=(tstring *)wl->ExchangePrevious();
  1497.     if(ts != (tstring *)0)
  1498.     {
  1499.         PROBLEM("ExchangePrevious list size 2");
  1500.         pass=FALSE;
  1501.     }
  1502.     wl->LastData();
  1503.     ts=(tstring *)wl->ExchangePrevious();
  1504.     result=ts->Tstring();
  1505.     if(!streql(result,"1"))
  1506.     {
  1507.         PROBLEM("ExchangePrevious list size 2");
  1508.         pass=FALSE;
  1509.     }
  1510.     ts=(tstring *)wl->CurrentData();
  1511.     result=ts->Tstring();
  1512.     if(!streql(result,"1"))
  1513.     {
  1514.         PROBLEM("ExchangePrevious list size 2");
  1515.         pass=FALSE;
  1516.     }
  1517.     ts=(tstring *)wl->ExchangePrevious();
  1518.     result=ts->Tstring();
  1519.     if(!streql(result,"2"))
  1520.     {
  1521.         PROBLEM("ExchangePrevious list size 2");
  1522.         pass=FALSE;
  1523.     }
  1524.     ts=(tstring *)wl->LastData();
  1525.     result=ts->Tstring();
  1526.     if(!streql(result,"2"))
  1527.     {
  1528.         PROBLEM("ExchangePrevious list size 2");
  1529.         pass=FALSE;
  1530.     }
  1531.     if(!pass)
  1532.     {
  1533.         printf("\tfunction %s failed 2 element list test\n",function);
  1534.         passall=FALSE;
  1535.         pass=TRUE;
  1536.     }
  1537.     wl->DeleteAll();
  1538.     //-----------------------------------------------------------------
  1539.     // test with 3 nodes in list
  1540.     //-----------------------------------------------------------------
  1541.     wlbuild(wl,3);
  1542.     wl->LastData();
  1543.     ts=(tstring *)wl->ExchangePrevious();
  1544.     result=ts->Tstring();
  1545.     if(!streql(result,"2"))
  1546.     {
  1547.         PROBLEM("ExchangePrevious list size 3");
  1548.         pass=FALSE;
  1549.     }
  1550.     wl->PreviousData();
  1551.     ts=(tstring *)wl->ExchangePrevious();
  1552.     result=ts->Tstring();
  1553.     if(!streql(result,"1"))
  1554.     {
  1555.         PROBLEM("ExchangePrevious list size 3");
  1556.         pass=FALSE;
  1557.     }
  1558.     ts=(tstring *)wl->FirstData();
  1559.     result=ts->Tstring();
  1560.     if(!streql(result,"3"))
  1561.     {
  1562.         PROBLEM("ExchangePrevious list size 3");
  1563.         pass=FALSE;
  1564.     }
  1565.     if(!pass)
  1566.     {
  1567.         printf("\tfunction %s failed 3 element list test\n",function);
  1568.         passall=FALSE;
  1569.         pass=TRUE;
  1570.     }
  1571.     wl->DeleteAll();
  1572.     return passall;
  1573. }
  1574. //-------------------------------------------------------------------------
  1575. // test_ExchangeNext
  1576. //-------------------------------------------------------------------------
  1577. int test_ExchangeNext(){
  1578.     char    *function    =    "ExchangeNext";
  1579.     tstring *ts;
  1580.     wlist *wl;
  1581.     int pass=TRUE;
  1582.     int passall=TRUE;
  1583.     char    *result;
  1584.  
  1585.     wl=new wlist;
  1586.     wl->SetPrintData(print_tstring);
  1587.     wl->SetCompareData(compare_tstring);
  1588.  
  1589.     //-----------------------------------------------------------------
  1590.     // test with empty list
  1591.     //-----------------------------------------------------------------
  1592.     ts = (tstring *)wl->ExchangeNext();
  1593.     if(ts != (tstring *)0)
  1594.     {
  1595.         PROBLEM("ExchangeNext empty list");
  1596.         pass=FALSE;
  1597.     }
  1598.     if(!pass)
  1599.     {
  1600.         printf("\tfunction %s failed empty list test\n",function);
  1601.         passall=FALSE;
  1602.         pass=TRUE;
  1603.     }
  1604.     wl->DeleteAll();
  1605.     //-----------------------------------------------------------------
  1606.     // test with one nodes in list
  1607.     //-----------------------------------------------------------------
  1608.     wlbuild(wl,1);
  1609.     ts=(tstring *)wl->ExchangeNext();
  1610.     if(ts != (tstring *)0)
  1611.     {
  1612.         PROBLEM("ExchangeNext list size 1");
  1613.         pass=FALSE;
  1614.     }
  1615.     if(!pass)
  1616.     {
  1617.         printf("\tfunction %s failed 1 element list test\n",function);
  1618.         passall=FALSE;
  1619.         pass=TRUE;
  1620.     }
  1621.     wl->DeleteAll();
  1622.     //-----------------------------------------------------------------
  1623.     // test with 2 nodes in list list
  1624.     //-----------------------------------------------------------------
  1625.     wlbuild(wl,2);
  1626.     wl->LastData();
  1627.     ts=(tstring *)wl->ExchangeNext();
  1628.     if(ts != (tstring *)0)
  1629.     {
  1630.         PROBLEM("ExchangeNext list size 2");
  1631.         pass=FALSE;
  1632.     }
  1633.     wl->FirstData();
  1634.     ts=(tstring *)wl->ExchangeNext();
  1635.     result=ts->Tstring();
  1636.     if(!streql(result,"2"))
  1637.     {
  1638.         PROBLEM("ExchangeNext list size 2");
  1639.         pass=FALSE;
  1640.     }
  1641.     ts=(tstring *)wl->CurrentData();
  1642.     result=ts->Tstring();
  1643.     if(!streql(result,"2"))
  1644.     {
  1645.         PROBLEM("ExchangeNext list size 2");
  1646.         pass=FALSE;
  1647.     }
  1648.     ts=(tstring *)wl->ExchangeNext();
  1649.     result=ts->Tstring();
  1650.     if(!streql(result,"1"))
  1651.     {
  1652.         PROBLEM("ExchangeNext list size 2");
  1653.         pass=FALSE;
  1654.     }
  1655.     ts=(tstring *)wl->LastData();
  1656.     result=ts->Tstring();
  1657.     if(!streql(result,"2"))
  1658.     {
  1659.         PROBLEM("ExchangeNext list size 2");
  1660.         pass=FALSE;
  1661.     }
  1662.     if(!pass)
  1663.     {
  1664.         printf("\tfunction %s failed 2 element list test\n",function);
  1665.         passall=FALSE;
  1666.         pass=TRUE;
  1667.     }
  1668.     wl->DeleteAll();
  1669.     //-----------------------------------------------------------------
  1670.     // test with 3 nodes in list
  1671.     //-----------------------------------------------------------------
  1672.     wlbuild(wl,3);
  1673.     wl->FirstData();
  1674.     ts=(tstring *)wl->ExchangeNext();
  1675.     result=ts->Tstring();
  1676.     if(!streql(result,"2"))
  1677.     {
  1678.         PROBLEM("ExchangeNext list size 3");
  1679.         pass=FALSE;
  1680.     }
  1681.     wl->NextData();
  1682.     ts=(tstring *)wl->ExchangeNext();
  1683.     result=ts->Tstring();
  1684.     if(!streql(result,"3"))
  1685.     {
  1686.         PROBLEM("ExchangeNext list size 3");
  1687.         wl->print();
  1688.         pass=FALSE;
  1689.     }
  1690.     ts=(tstring *)wl->LastData();
  1691.     result=ts->Tstring();
  1692.     if(!streql(result,"1"))
  1693.     {
  1694.         PROBLEM("ExchangeNext list size 3");
  1695.         wl->print();
  1696.         pass=FALSE;
  1697.     }
  1698.     ts = (tstring *)wl->ExchangeNext();
  1699.     if(ts != (tstring *)0)
  1700.     {
  1701.         PROBLEM("ExchangeNext list size 3");
  1702.         pass=FALSE;
  1703.     }
  1704.     if(!pass)
  1705.     {
  1706.         printf("\tfunction %s failed 3 element list test\n",function);
  1707.         passall=FALSE;
  1708.         pass=TRUE;
  1709.     }
  1710.     wl->DeleteAll();
  1711.     return passall;
  1712. }
  1713. //-------------------------------------------------------------------------
  1714. // test_Minimum
  1715. //-------------------------------------------------------------------------
  1716. int test_Minimum(){
  1717.     char    *function    =    "Minimum";
  1718.     tstring *ts;
  1719.     wlist *wl;
  1720.     int pass=TRUE;
  1721.     int passall=TRUE;
  1722.     char    *result;
  1723.  
  1724.     wl=new wlist;
  1725.     wl->SetPrintData(print_tstring);
  1726.     wl->SetCompareData(compare_tstring);
  1727.  
  1728.     //-----------------------------------------------------------------
  1729.     // test with empty list
  1730.     //-----------------------------------------------------------------
  1731.     ts=(tstring *)wl->Minimum();
  1732.     if(ts != (tstring *)0)
  1733.     {
  1734.         pass=FALSE;
  1735.         PROBLEM("Minimum list size 0");
  1736.     }
  1737.     if(!pass)
  1738.     {
  1739.         printf("\tfunction %s failed empty list test\n",function);
  1740.         passall=FALSE;
  1741.         pass=TRUE;
  1742.     }
  1743.     wl->DeleteAll();
  1744.     //-----------------------------------------------------------------
  1745.     // test with one nodes in list
  1746.     //-----------------------------------------------------------------
  1747.     wlbuild(wl,1);
  1748.     ts=(tstring *)wl->Minimum();
  1749.     result = ts->Tstring();
  1750.     if(!streql(result,"1"))
  1751.     {
  1752.         pass=FALSE;
  1753.         printf("result %s\n",result);
  1754.         PROBLEM("Minimum list size 1");
  1755.     }
  1756.     ts=(tstring *)wl->CurrentData();
  1757.     result = ts->Tstring();
  1758.     if(!streql(result,"1"))
  1759.     {
  1760.         pass=FALSE;
  1761.         PROBLEM("Minimum list size 1");
  1762.     }
  1763.     if(!pass)
  1764.     {
  1765.         printf("\tfunction %s failed 1 element list test\n",function);
  1766.         passall=FALSE;
  1767.         pass=TRUE;
  1768.     }
  1769.     wl->DeleteAll();
  1770.     //-----------------------------------------------------------------
  1771.     // test with 2 nodes in list list
  1772.     //-----------------------------------------------------------------
  1773.     wlbuild(wl,2);
  1774.     ts=(tstring *)wl->Minimum();
  1775.     result = ts->Tstring();
  1776.     if(!streql(result,"1"))
  1777.     {
  1778.         pass=FALSE;
  1779.         PROBLEM("Minimum list size 2");
  1780.     }
  1781.     ts=(tstring *)wl->CurrentData();
  1782.     result = ts->Tstring();
  1783.     if(!streql(result,"1"))
  1784.     {
  1785.         pass=FALSE;
  1786.         PROBLEM("Minimum list size 2");
  1787.     }
  1788.     wl->Reverse();
  1789.     ts=(tstring *)wl->Minimum();
  1790.     result = ts->Tstring();
  1791.     if(!streql(result,"1"))
  1792.     {
  1793.         pass=FALSE;
  1794.         PROBLEM("Minimum list size 2");
  1795.     }
  1796.     ts=(tstring *)wl->CurrentData();
  1797.     result = ts->Tstring();
  1798.     if(!streql(result,"1"))
  1799.     {
  1800.         pass=FALSE;
  1801.         PROBLEM("Minimum list size 2");
  1802.     }
  1803.     if(!pass)
  1804.     {
  1805.         printf("\tfunction %s failed 2 element list test\n",function);
  1806.         passall=FALSE;
  1807.         pass=TRUE;
  1808.     }
  1809.     wl->DeleteAll();
  1810.     //-----------------------------------------------------------------
  1811.     // test with 3 nodes in list
  1812.     //-----------------------------------------------------------------
  1813.     wlbuild(wl,3);
  1814.     ts=(tstring *)wl->Minimum();
  1815.     result = ts->Tstring();
  1816.     if(!streql(result,"1"))
  1817.     {
  1818.         pass=FALSE;
  1819.         PROBLEM("Minimum list size 3");
  1820.     }
  1821.     ts=(tstring *)wl->CurrentData();
  1822.     result = ts->Tstring();
  1823.     if(!streql(result,"1"))
  1824.     {
  1825.         pass=FALSE;
  1826.         PROBLEM("Minimum list size 3");
  1827.     }
  1828.     wl->Reverse();
  1829.     ts=(tstring *)wl->Minimum();
  1830.     result = ts->Tstring();
  1831.     if(!streql(result,"1"))
  1832.     {
  1833.         pass=FALSE;
  1834.         PROBLEM("Minimum list size 3");
  1835.     }
  1836.     ts=(tstring *)wl->CurrentData();
  1837.     result = ts->Tstring();
  1838.     if(!streql(result,"1"))
  1839.     {
  1840.         pass=FALSE;
  1841.         PROBLEM("Minimum list size 3");
  1842.     }
  1843.  
  1844.  
  1845.     if(!pass)
  1846.     {
  1847.         printf("\tfunction %s failed 3 element list test\n",function);
  1848.         passall=FALSE;
  1849.         pass=TRUE;
  1850.     }
  1851.     wl->DeleteAll();
  1852.     return passall;
  1853. }
  1854. //-------------------------------------------------------------------------
  1855. // test_Maximum
  1856. //-------------------------------------------------------------------------
  1857. int test_Maximum(){
  1858.     char    *function    =    "Maximum";
  1859.     tstring *ts;
  1860.     wlist *wl;
  1861.     int pass=TRUE;
  1862.     int passall=TRUE;
  1863.     char    *result;
  1864.  
  1865.     wl=new wlist;
  1866.     wl->SetPrintData(print_tstring);
  1867.     wl->SetCompareData(compare_tstring);
  1868.  
  1869.     //-----------------------------------------------------------------
  1870.     // test with empty list
  1871.     //-----------------------------------------------------------------
  1872.     ts=(tstring *)wl->Maximum();
  1873.     if(ts != (tstring *)0)
  1874.     {
  1875.         pass=FALSE;
  1876.         PROBLEM("Maximum list size 0");
  1877.     }
  1878.     if(!pass)
  1879.     {
  1880.         printf("\tfunction %s failed empty list test\n",function);
  1881.         passall=FALSE;
  1882.         pass=TRUE;
  1883.     }
  1884.     wl->DeleteAll();
  1885.     //-----------------------------------------------------------------
  1886.     // test with one nodes in list
  1887.     //-----------------------------------------------------------------
  1888.     wlbuild(wl,1);
  1889.     ts=(tstring *)wl->Maximum();
  1890.     result = ts->Tstring();
  1891.     if(!streql(result,"1"))
  1892.     {
  1893.         pass=FALSE;
  1894.         PROBLEM("Maximum list size 1");
  1895.     }
  1896.     ts=(tstring *)wl->CurrentData();
  1897.     result = ts->Tstring();
  1898.     if(!streql(result,"1"))
  1899.     {
  1900.         pass=FALSE;
  1901.         PROBLEM("Maximum list size 1");
  1902.     }
  1903.     if(!pass)
  1904.     {
  1905.         printf("\tfunction %s failed 1 element list test\n",function);
  1906.         passall=FALSE;
  1907.         pass=TRUE;
  1908.     }
  1909.     wl->DeleteAll();
  1910.     //-----------------------------------------------------------------
  1911.     // test with 2 nodes in list list
  1912.     //-----------------------------------------------------------------
  1913.     wlbuild(wl,2);
  1914.     ts=(tstring *)wl->Maximum();
  1915.     result = ts->Tstring();
  1916.     if(!streql(result,"2"))
  1917.     {
  1918.         pass=FALSE;
  1919.         PROBLEM("Maximum list size 2");
  1920.     }
  1921.     ts=(tstring *)wl->CurrentData();
  1922.     result = ts->Tstring();
  1923.     if(!streql(result,"2"))
  1924.     {
  1925.         pass=FALSE;
  1926.         PROBLEM("Maximum list size 2");
  1927.     }
  1928.     wl->Reverse();
  1929.     ts=(tstring *)wl->Maximum();
  1930.     result = ts->Tstring();
  1931.     if(!streql(result,"2"))
  1932.     {
  1933.         pass=FALSE;
  1934.         PROBLEM("Maximum list size 2");
  1935.     }
  1936.     ts=(tstring *)wl->CurrentData();
  1937.     result = ts->Tstring();
  1938.     if(!streql(result,"2"))
  1939.     {
  1940.         pass=FALSE;
  1941.         PROBLEM("Maximum list size 2");
  1942.     }
  1943.     if(!pass)
  1944.     {
  1945.         printf("\tfunction %s failed 2 element list test\n",function);
  1946.         passall=FALSE;
  1947.         pass=TRUE;
  1948.     }
  1949.     wl->DeleteAll();
  1950.     //-----------------------------------------------------------------
  1951.     // test with 3 nodes in list
  1952.     //-----------------------------------------------------------------
  1953.     wlbuild(wl,3);
  1954.     ts=(tstring *)wl->Maximum();
  1955.     result = ts->Tstring();
  1956.     if(!streql(result,"3"))
  1957.     {
  1958.         pass=FALSE;
  1959.         PROBLEM("Maximum list size 3");
  1960.     }
  1961.     ts=(tstring *)wl->CurrentData();
  1962.     result = ts->Tstring();
  1963.     if(!streql(result,"3"))
  1964.     {
  1965.         pass=FALSE;
  1966.         PROBLEM("Maximum list size 3");
  1967.     }
  1968.     wl->Reverse();
  1969.     ts=(tstring *)wl->Maximum();
  1970.     result = ts->Tstring();
  1971.     if(!streql(result,"3"))
  1972.     {
  1973.         pass=FALSE;
  1974.         PROBLEM("Maximum list size 3");
  1975.     }
  1976.     ts=(tstring *)wl->CurrentData();
  1977.     result = ts->Tstring();
  1978.     if(!streql(result,"3"))
  1979.     {
  1980.         pass=FALSE;
  1981.         PROBLEM("Maximum list size 3");
  1982.     }
  1983.  
  1984.  
  1985.     if(!pass)
  1986.     {
  1987.         printf("\tfunction %s failed 3 element list test\n",function);
  1988.         passall=FALSE;
  1989.         pass=TRUE;
  1990.     }
  1991.     wl->DeleteAll();
  1992.     return passall;
  1993. }
  1994. //-------------------------------------------------------------------------
  1995. // test_Sort
  1996. //-------------------------------------------------------------------------
  1997. int test_Sort(){
  1998.     char    *function    =    "Sort";
  1999.     tstring *ts;
  2000.     wlist *wl;
  2001.     wlist *xl;
  2002.     int pass=TRUE;
  2003.     int passall=TRUE;
  2004.     char    *result;
  2005.  
  2006.     wl=new wlist;
  2007.     wl->SetPrintData(print_tstring);
  2008.     wl->SetCompareData(compare_tstring);
  2009.  
  2010.     //-----------------------------------------------------------------
  2011.     // test with empty list
  2012.     //-----------------------------------------------------------------
  2013.     xl=wl->Sort();
  2014.     if(xl == (wlist *)0 || xl->Size() != 0)
  2015.     {
  2016.         PROBLEM("Sort() list size 0");
  2017.         pass=FALSE;
  2018.     }
  2019.     if(!pass)
  2020.     {
  2021.         printf("\tfunction %s failed empty list test\n",function);
  2022.         passall=FALSE;
  2023.         pass=TRUE;
  2024.     }
  2025.     wl->DeleteAll();
  2026.     delete xl;
  2027.     //-----------------------------------------------------------------
  2028.     // test with one nodes in list
  2029.     //-----------------------------------------------------------------
  2030.     wlbuild(wl,1);
  2031.     xl=wl->Sort();
  2032.     if(xl == (wlist *)0 || xl->Size() == 0)
  2033.     {
  2034.         PROBLEM("Sort() list size 0");
  2035.         pass=FALSE;
  2036.     }
  2037.     ts=(tstring *)xl->FirstData();
  2038.     result=ts->Tstring();
  2039.     if(!streql(result,"1"))
  2040.     {
  2041.         PROBLEM("Sort() list size 1");
  2042.         pass=FALSE;
  2043.     }
  2044.     if(!pass)
  2045.     {
  2046.         printf("\tfunction %s failed 1 element list test\n",function);
  2047.         passall=FALSE;
  2048.         pass=TRUE;
  2049.     }
  2050.     wl->DeleteAll();
  2051.     delete xl;
  2052.     //-----------------------------------------------------------------
  2053.     // test with 2 nodes in list list
  2054.     //-----------------------------------------------------------------
  2055.     wlbuild(wl,2);
  2056.     xl=wl->Sort();
  2057.     ts=(tstring *)xl->FirstData();
  2058.     result=ts->Tstring();
  2059.     if(!streql(result,"1"))
  2060.     {
  2061.         PROBLEM("Sort() list size 2");
  2062.         pass=FALSE;
  2063.     }
  2064.     ts=(tstring *)xl->NextData();
  2065.     result=ts->Tstring();
  2066.     if(!streql(result,"2"))
  2067.     {
  2068.         PROBLEM("Sort() list size 2");
  2069.         pass=FALSE;
  2070.     }
  2071.     delete xl;
  2072.     wl->Reverse();
  2073.     xl=wl->Sort();
  2074.     ts=(tstring *)xl->FirstData();
  2075.     result=ts->Tstring();
  2076.     if(!streql(result,"1"))
  2077.     {
  2078.         PROBLEM("Sort() list size 2");
  2079.         pass=FALSE;
  2080.     }
  2081.     ts=(tstring *)xl->NextData();
  2082.     result=ts->Tstring();
  2083.     if(!streql(result,"2"))
  2084.     {
  2085.         PROBLEM("Sort() list size 2");
  2086.         pass=FALSE;
  2087.     }
  2088.  
  2089.     if(!pass)
  2090.     {
  2091.         printf("\tfunction %s failed 2 element list test\n",function);
  2092.         passall=FALSE;
  2093.         pass=TRUE;
  2094.     }
  2095.     wl->DeleteAll();
  2096.     delete xl;
  2097.     //-----------------------------------------------------------------
  2098.     // test with 3 nodes in list
  2099.     //-----------------------------------------------------------------
  2100.     wlbuild(wl,3);
  2101.     xl=wl->Sort();
  2102.     ts=(tstring *)xl->FirstData();
  2103.     result=ts->Tstring();
  2104.     if(!streql(result,"1"))
  2105.     {
  2106.         PROBLEM("Sort() list size 3");
  2107.         pass=FALSE;
  2108.     }
  2109.     ts=(tstring *)xl->NextData();
  2110.     result=ts->Tstring();
  2111.     if(!streql(result,"2"))
  2112.     {
  2113.         PROBLEM("Sort() list size 3");
  2114.         pass=FALSE;
  2115.     }
  2116.     ts=(tstring *)xl->NextData();
  2117.     result=ts->Tstring();
  2118.     if(!streql(result,"3"))
  2119.     {
  2120.         PROBLEM("Sort() list size 3");
  2121.         pass=FALSE;
  2122.     }
  2123.     delete xl;
  2124.     wl->Reverse();
  2125.     xl=wl->Sort();
  2126.     ts=(tstring *)xl->FirstData();
  2127.     result=ts->Tstring();
  2128.     if(!streql(result,"1"))
  2129.     {
  2130.         PROBLEM("Sort() list size 3");
  2131.         pass=FALSE;
  2132.     }
  2133.     ts=(tstring *)xl->NextData();
  2134.     result=ts->Tstring();
  2135.     if(!streql(result,"2"))
  2136.     {
  2137.         PROBLEM("Sort() list size 3");
  2138.         pass=FALSE;
  2139.     }
  2140.     ts=(tstring *)xl->NextData();
  2141.     result=ts->Tstring();
  2142.     if(!streql(result,"3"))
  2143.     {
  2144.         PROBLEM("Sort() list size 3");
  2145.         pass=FALSE;
  2146.     }
  2147.     delete xl;
  2148.  
  2149.     if(!pass)
  2150.     {
  2151.         printf("\tfunction %s failed 3 element list test\n",function);
  2152.         passall=FALSE;
  2153.         pass=TRUE;
  2154.     }
  2155.     delete wl;
  2156.     return passall;
  2157. }
  2158.